package com.ry.novel.utils;

import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author ry
 * @since 2022-02-19 08:41
 **/
@Slf4j
public class DateUtil {
    private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

    public static String format(String origin){
        if (null == origin){
            return null;
        }
//        log.info("日期格式化");
        LocalDateTime localDateTime = LocalDateTime.parse(origin);

        String result = localDateTime.format(FORMATTER);

        return result;
    }
}
